package com.chalk.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Value("${upload.dir}")
    private String dir;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        System.out.println("-----------上传目录-----"+dir);

        registry.addResourceHandler("/upload/**").addResourceLocations("file:"+dir+"/");
    }



}
